<?php
	$link = mysqli_connect("localhost", "root", "") or die("数据连接失败");
	mysqli_set_charset($link, "utf8");
	mysqli_select_db($link, "bbs");
	$sql = "select * from config";
	$res = mysqli_query($link, $sql);
	if ($res && mysqli_num_rows($res) > 0) {
		while ($rows = mysqli_fetch_assoc($res)) {
			if ($rows['status'] =="1") {

				?>
				<!DOCTYPE html>
				<html>
				<head>
					<meta charset="utf-8"/>
					<title>LAMP圣才</title>

				</head>
				<link rel="stylesheet" href="../public/home/css/index.css">
				<body>
				<!--顶部条-->
				<?php require "./foot/header.php"; ?>
				<!--导航条结束-->

				<!--大盒子-->
				<div id='big'>
					<!--顶部搜索条-->
					<div id="search">
						<form action="./public/indexaction.php" method="post">
							<input type="text" placeholder="让学习成为一种习惯!" name="name" value="">
							<select name="module">
								<option value="1">帖子</option>
								<option value="2">日志</option>
								<option value="3">用户</option>
								<option value="4">板块</option>
							</select>
							<input type="submit" value="搜索">
						</form>
						<ul id="hot">
							<li>热搜：</li>
							<li class="red">php</li>
							<li class="red">php视频</li>
							<li class="red">php教程</li>
						</ul>
						<div id="guanzhu">
							<ul>
								<li><a href="#"><img src="../public/home/img/sina_n.png" title="关注新浪微博"/></a></li>
								<li><a href="#"><img src="../public/home/img/qq_n.png" title="添加到QQ"/></a></li>
								<li><a href="#"><img src="../public/home/img/6.gif" title="添加笔记"/></a></li>
								<li><a href="#"><img src="../public/home/img/21.gif" title="百度浏览"/></a></li>
								<li><a href="#"><img src="../public/home/img/medal.png" title="排行榜"/></a></li>
							</ul>
						</div>
					</div>
					<!--顶部搜索条结束-->

					<!--banner开始-->
					<div id="banner">
						<div id="leftban">
							<img src="../public/home/img/banner2.jpg"/>
						</div>
						<div id="middleban">
							<div class="topban">
								<img src="../public/home/img/topban1.jpg"/>
							</div>
							<div class="bottomban">
								<img src="../public/home/img/bottomban1.jpg"/>
							</div>
						</div>
						<div id="rightban">
							<div class="bottomban">
								<img src="../public/home/img/bottomban2.jpg"/>
							</div>
							<div class="topban">
								<img src="../public/home/img/topban2.jpg"/>
							</div>
						</div>
					</div>
					<!--banner结束-->

					<!--统计开始-->
					<div id="count">
						<div id="tongzhi">
							<ul>
								<li><a href="#" id="one">跟圣才学php正式发售啦</a></li>
								<li><a href="#" id="two">圣才2016年PHP课程体系全面升级！</a></li>
								<li><a href="#" id="three">圣才视频教程免费下载地址汇总</a></li>
								<li><a href="#" id="four">HTML5就业班，包吃、包住、包就业！</a></li>
							</ul>
						</div>
						<div id="tongji">
							<ul>
								<li>今日:<a href="#">169</a>|</li>
								<li>昨日:<a href="#">47</a>|</li>
								<li>最高日:<a href="#">116787</a>|</li>
								<li>会员:<a href="#">382450</a>|</li>
								<li>新会员:<a href="#">我是大牛</a></li>
							</ul>
						</div>
					</div>
					<!--统计结束-->
					<?php
					$link = mysqli_connect("localhost", "root", "") or die("数据连接失败");
					mysqli_set_charset($link, "utf8");
					mysqli_select_db($link, "bbs");
					$sql = "select * from type where status='1' && pid=0 ";
					$res2 = mysqli_query($link, $sql);
					if ($res2 && mysqli_num_rows($res2) > 0) {
						while ($rows = mysqli_fetch_assoc($res2)) {
//					$path="./../public/home/img/";
//					$path = rtrim($path,'/').'/';
//					$npath = $rows['npath'];

							echo "<div id='qushi'>";

							echo "<div class='biaoti'>";
							echo "<div class='dabiao'></div>";
							echo "<h5>:::.{$rows['name']}:::.</h5>";
							echo "<div class='topjian'></div>";
							echo "</div>";
							$id = $rows['id'];

							$sql = "select * from type where status='1' && pid={$id} ";
							$res3 = mysqli_query($link, $sql);
							if ($res3 && mysqli_num_rows($res3) > 0) {
								while ($rows = mysqli_fetch_assoc($res3)) {
									$path = "./../public/home/img/";
									$path = rtrim($path, '/') . '/';

									echo "<div class='bankuai' style='margin-left: 10px;'>";
									echo "<div class='tu'>";
									echo "<a href='#'><img src='{$path}{$rows['blogo']}'/></a>";
									echo "</div>";
									echo "<div class='wen'>";
									echo "<ul>";
									echo "<li><a href='list.php?id={$rows['id']}' class='dbt'>{$rows['name']}</a><span>（今日14）</span></li>";
									echo "<li>主题：10737 帖子：523554</li>";
									echo "<li>最后发帖:2016-02-17 17:42</li>";
									echo "</ul>";
									echo "</div>";
									echo "</div>";

								}
							}
							echo "</div>";
						}
					}
					//			mysqli_free_result($res);

					?>



					<?php

					//			<!--友情链接开始-->
					echo "<div id='youqing'>";
					echo "<div class='biaoti'>";
					echo "<div class='dabiao'></div>";
					echo "<h5>:::.友情链接:::.</h5>";
					echo "<div class='topjian'></div>";
					echo "</div>";

					echo "<ul>";
					$link = mysqli_connect("localhost", "root", "") or die("数据连接失败");
					mysqli_set_charset($link, "utf8");
					mysqli_select_db($link, "bbs");
					$sql = "select * from friendlink";
					$res4 = mysqli_query($link, $sql);
					if ($res4 && mysqli_num_rows($res4) > 0) {
						while ($rows = mysqli_fetch_assoc($res4)) {

							echo "<li><a href='#'>{$rows['linkname']}</a></li>";

						}
					}

					echo "</ul>";
					echo "</div>";
					//			<!--友情链接结束-->
					?>
				</div>


				<!--大盒子结束-->

				<!--页面尾开始-->
				<?php require "./foot/footer.php"; ?>
				<!--页面尾结束-->
				</body>
				</html>
				<?php
			}else{
				echo '网页正在维护,请稍后再来';
			}
		}
	}
	mysqli_close($link);
?>